﻿using System;
using System.Reflection;
using System.Diagnostics;
using LinFu.Proxy.Interfaces;

namespace CoreEx.Common.Proxy
{
    /// <summary>
    /// Represents the information associated with a call to the parameterless 
    /// constructor of an <see cref="IProxy"/> type.
    /// </summary>
    public interface IInitalizationInfo
    {
        /// <summary>
        /// The target instance currently being called.
        /// </summary>
        /// <remarks>This typically is a reference to a proxy object.</remarks>
        object Target { get; }

        /// <summary>
        /// The constructor currently being called.
        /// </summary>
        ConstructorInfo TargetConstructor { get; }

        /// <summary>
        /// The <see cref="StackTrace"/> associated
        /// with the method call when the call was made.
        /// </summary>
        StackTrace StackTrace { get; }

        /// <summary>
        /// This is the actual calling method that invoked the <see cref="TargetConstructor"/>.
        /// </summary>
        MethodBase CallingMethod { get; }

        /// <summary>
        /// Gets the base <see cref="Type"/> that the proxy type derives from.
        /// </summary>
        /// <remarks>
        /// If you pass an interface as the base type when calling <see cref="IProxyFactory.CreateProxyType"/>, 
        /// this property will return <see cref="object"/>.       
        /// </remarks>
        Type BaseType { get; }

        /// <summary>
        /// Gets a list of interfaces implemented by the proxy type.
        /// </summary>
        /// <remarks>
        /// If you pass an interface as the base type when calling <see cref="IProxyFactory.CreateProxyType"/>, the 
        /// interface type passed in as the base type will be available as the last element in the array.
        /// </remarks>
        Type[] Interfaces { get; }            
    } 
}